/**
 * Copyright The Apache Software Foundation
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with this
 * work for additional information regarding copyright ownership. The ASF
 * licenses this file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.alibaba.wasp.fserver.metrics;

import com.alibaba.wasp.metrics.BaseSource;

/** Interface of a class to make assertions about metrics values. */
public interface MetricsAssertHelper {

  /**
   * Assert that a tag exists and has a given value.
   * 
   * @param name The name of the tag.
   * @param expected The expected value
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertTag(String name, String expected, BaseSource source);

  /**
   * Assert that a gauge exists and that it's value is equal to the expected
   * value.
   *
   * @param name The name of the gauge
   * @param expected The expected value of the gauge.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGauge(String name, long expected, BaseSource source);

  /**
   * Assert that a gauge exists and it's value is greater than a given value
   *
   * @param name The name of the gauge
   * @param expected Value that the gauge is expected to be greater than
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGaugeGt(String name, long expected, BaseSource source);

  /**
   * Assert that a gauge exists and it's value is less than a given value
   *
   * @param name The name of the gauge
   * @param expected Value that the gauge is expected to be less than
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGaugeLt(String name, long expected, BaseSource source);

  /**
   * Assert that a gauge exists and that it's value is equal to the expected
   * value.
   *
   * @param name The name of the gauge
   * @param expected The expected value of the gauge.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGauge(String name, double expected, BaseSource source);

  /**
   * Assert that a gauge exists and it's value is greater than a given value
   *
   * @param name The name of the gauge
   * @param expected Value that the gauge is expected to be greater than
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGaugeGt(String name, double expected, BaseSource source);

  /**
   * Assert that a gauge exists and it's value is less than a given value
   *
   * @param name The name of the gauge
   * @param expected Value that the gauge is expected to be less than
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertGaugeLt(String name, double expected, BaseSource source);

  /**
   * Assert that a counter exists and that it's value is equal to the expected
   * value.
   *
   * @param name The name of the counter.
   * @param expected The expected value
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertCounter(String name, long expected, BaseSource source);

  /**
   * Assert that a counter exists and that it's value is greater than the given
   * value.
   *
   * @param name The name of the counter.
   * @param expected The value the counter is expected to be greater than.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertCounterGt(String name, long expected, BaseSource source);

  /**
   * Assert that a counter exists and that it's value is less than the given
   * value.
   *
   * @param name The name of the counter.
   * @param expected The value the counter is expected to be less than.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   */
  public void assertCounterLt(String name, long expected, BaseSource source);

  /**
   * Get the value of a counter.
   *
   * @param name name of the counter.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   * @return long value of the counter.
   */
  public long getCounter(String name, BaseSource source);

  /**
   * Get the value of a gauge as a double.
   *
   * @param name name of the gauge.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   * @return double value of the gauge.
   */
  public double getGaugeDouble(String name, BaseSource source);

  /**
   * Get the value of a gauge as a long.
   *
   * @param name name of the gauge.
   * @param source The BaseSource{@link com.alibaba.wasp.metrics.BaseSource} that will provide the tags,
   *          gauges, and counters.
   * @return long value of the gauge.
   */
  public long getGaugeLong(String name, BaseSource source);
}
